package com.example.demo.service;

import com.example.demo.main.Store;
import com.example.demo.main.StoreExample;
import com.example.demo.mapper.StoreMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UseSQLByStore {

    @Autowired
    private StoreMapper storeMapper;
    @Autowired
    private StoreExample storeExample;

    public Store selectById(Long id){
        return storeMapper.selectByPrimaryKey(id);
    }

    public List<Store> selectByUsrName(String name){
        storeExample.clear();
        storeExample.or().andUserNameEqualTo(name);
        return storeMapper.selectByExample(storeExample);
    }
}
